const MyPromise = require('./MyPromise')

const p1 = new MyPromise((resolve, reject) => {
  setTimeout(() => {
    resolve(3)
  }, 1000)
})
const p2 = new MyPromise((resolve, reject) => {
  setTimeout(() => {
    reject('promise2')
  }, 50)
})

/* p1.then().then(value => {
  console.log(value)
  return p2
}, reason => {
  console.log(reason, '失败')
}).then(value => {
  console.log(value)
}, reason => {console.log(reason, '失败')}) */

MyPromise.resolve(4).then(value => {
  console.log(value)
})